package map;

import java.awt.Dimension;
import java.util.HashMap;

import accessory.GameProperty;
import accessory.GamePropertyType;

public class RasterbasedMap implements GameMap{

	public final String MAP_VERSION = "GENERIC_1";
	
	HashMap<String, GameProperty> properties;
	Dimension dimension;
	RasterCell[][] mapRaster;
	
	public RasterbasedMap(int width, int height) {
		properties = new HashMap<String, GameProperty>();
		mapRaster = new RasterCell[width][height];
		dimension = new Dimension(width, height);

		addProperty("name", "unnamed world", GamePropertyType.TEXT);
		addProperty("spawnpoint X", 0, GamePropertyType.NUMERIC_VALUE);
		addProperty("spawnpoint Y", 0, GamePropertyType.NUMERIC_VALUE);
		//addProperty("spawnpoint ", new Dimension(0, 0), GamePropertyType.X_Y_COORDINATE);
	}

	public HashMap<String, GameProperty> getProperties() {
		return properties;
	}

	public void setProperties(HashMap<String, GameProperty> properties) {
		this.properties = properties;
	}

	public Dimension getDimension() {
		return dimension;
	}


	public RasterCell[][] getMapRaster() {
		return mapRaster;
	}

	public void setMapRaster(RasterCell[][] mapRaster) {
		this.mapRaster = mapRaster;
		this.dimension = new Dimension(mapRaster.length, mapRaster[0].length);
	}
	

	public void addProperty(GameProperty arg){
		properties.put(arg.getName(), arg);
	}
	
	public void addProperty(String name, String value){
		properties.put(name, new GameProperty(name, value));
	}

	public void addProperty(String name, String value, GamePropertyType type){
		properties.put(name, new GameProperty(name, value, type));
	}
	
	public void addProperty(String name, Object value, GamePropertyType type){
		properties.put(name, new GameProperty(name, value, type));
	}
	
}
